﻿using System;
using Autodesk.Revit.DB;
using FrontRoomCheck.Properties;
using FrontRoomCheck.Utiltiy;
using YJKRevitCode.FormUtility.ModelessFormControlSuite.ControlLayer;

namespace FrontRoomCheck.ShowDataForm.FireProofGradeCheck
{
	public class DoorGradeModellessManger : BaseLoopMangerNoneSwitch
	{
		public DoorGradeModellessManger(FireProofGradeForm inputForm) : base(inputForm.uidoc, inputForm, inputForm.RevitHandle, null)
		{
			this.m_doc = inputForm.uidoc.Document;
		}

		protected override void DoBeforeContinue()
		{
			if (this.m_useForm is FireProofGradeForm)
			{
				FireProofGradeForm fireProofGradeForm = this.m_useForm as FireProofGradeForm;
				if (fireProofGradeForm.m_strReplaceOrder == "doubleClick")
				{
					fireProofGradeForm.DoBeforeContinue();
					return;
				}
				if (fireProofGradeForm.m_strReplaceOrder == "DoorOrWindowReplace")
				{
					fireProofGradeForm.DoBeforeContinue();
					return;
				}
				if (fireProofGradeForm.m_strReplaceOrder == "FrontRoomDoorReplace")
				{
					fireProofGradeForm.DoBeforeContinue();
					return;
				}
				if (fireProofGradeForm.m_strReplaceOrder == "CloseWall")
				{
					fireProofGradeForm.DoBeforeContinue();
					return;
				}
				if (fireProofGradeForm.m_strReplaceOrder == "TrustAction")
				{
					fireProofGradeForm.DoBeforeContinue();
				}
			}
		}

		protected override void DoAfterWhile()
		{
			if (this.m_useForm is FireProofGradeForm)
			{
				FireProofGradeForm fireProofGradeForm = this.m_useForm as FireProofGradeForm;
				InsertDataToRoom.WriteToElement(fireProofGradeForm.useRoom, Resources.DoorGuid, fireProofGradeForm.lsttmpdata);
			}
			base.DoAfterWhile();
		}

		private Document m_doc;
	}
}
